/*
                  SummaryInfo Class Implementation
*/
#include "SummaryInfo.h"

vector<PlayerGameInfo*> SummaryInfo::PlayerInfo = vector<PlayerGameInfo*>();
int SummaryInfo::iWinner = -1;

void SummaryInfo::AddPlayerInfo(Player* Player, bool bIsWinner)
{
    PlayerInfo.push_back(new PlayerGameInfo(
                                            Player->getName(),
                                            Player->getScore(),
                                            Player->getTotalScore(),
                                            Player->getKills(),
                                            Player->getDeaths()
                                            ));

    if (bIsWinner == true)
    {
        iWinner = PlayerInfo.size() - 1;
    }
}

void SummaryInfo::FreeInfo()
{
    for (int i = 0; i < PlayerInfo.size(); i++)
    {
        delete PlayerInfo.at(i);
    }

    PlayerInfo.clear();
}
